package com.winning.pmph.entity;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Table;
import java.util.List;

@EqualsAndHashCode(callSuper = true)
@Data
@Table(name = "TEMP_KNOWLEDGE")
public class TempKnowledge extends Knowledge {
    /**
     *
     */
    private static final long serialVersionUID = 1L;

    // Knowledge status
    /**
     * 状态: 全部;
     */
    public final static String KNOWLEDGE_STATUS_ALL = "-1";

    // Knowledge status
    /**
     * 新建/未提交
     */
    public final static int KNOWLEDGE_STATUS_UNCOMMIT = 0;

    /**
     * 一提交/初审中
     */
    public final static int KNOWLEDGE_STATUS_COMMITED = 1;

    /**
     * 初审通过/复审中
     */
    public final static int KNOWLEDGE_STATUS_PASS_1 = 2;

    /**
     * 初审驳回
     */
    public final static int KNOWLEDGE_STATUS_REJECT_1 = 3;

    /**
     * 复审通过/终审中
     */
    public final static int KNOWLEDGE_STATUS_PASS_2 = 4;

    /**
     * 复审驳回
     */
    public final static int KNOWLEDGE_STATUS_REJECT_2 = 5;

    /**
     * 审核通过/未发布
     */
    public final static int KNOWLEDGE_STATUS_PASS = 6;

    /**
     * 终审驳回
     */
    public final static int KNOWLEDGE_STATUS_REJECT_3 = 7;

    @TableField(exist = false)
    private String startDate;

    @TableField(exist = false)
    private String endDate;

    /**
     * 列表页类型  edit编辑列表   audit审核列表
     */
    @TableField(exist = false)
    private String type;

    /**
     * 前端传的数据状态
     */
    @TableField(exist = false)
    private String conditionStatus;

    @Override
    public int getStatus() {
        return 0;
    }

    public List<TempKnowledgeField> getTempKnowledgeFieldList() {
        return JSON.parseArray(JSON.toJSONString(getKnowledgeFieldList()), TempKnowledgeField.class);
    }
}
